home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_03
/
1103108b
< prev
next >
Wrap
Text File
|
1993-01-06
|
783b
|
42 lines
// fa1.h - a dynamic array of float using a subscripting
// object
#include <iostream.h>
class fa_index
{
friend class float_array;
public:
fa_index &operator=(float f);
operator float();
private:
fa_index(float_array *f, size_t i);
float_array *fa;
size_t ix;
};
class float_array
{
friend class fa_index;
public:
float_array(size_t n = 0);
float_array(const float_array &fa);
~float_array();
float_array &operator=(const float_array &fa);
float operator[](size_t i) const;
fa_index operator[](size_t i);
inline size_t length() const;
private:
void extend(size_t i);
float *array;
size_t len;
};
ostream &operator<<(ostream &os, const float_array &fa);
inline size_t float_array::length() const
{
return len;
}